﻿@model KidChoreApp.Web.Models.ChoreDetailVM

<h2>@Model.Chore.Name Details</h2>

<div class="jumbotron">
    <div>Task: @Model.Chore.Name</div>
    <div>Room: @Model.Chore.Room</div>
    @if (@Model.Chore.IsDone)
    {
        <div>Is Done: Yes</div>
    }
    else
    {
        <div>Is Done: No</div>
    }
    @if (@Model.Chore.IsRecurring)
    {
        <div>Is Recurring: Yes</div>
    }
    else
    {
        <div>Is Recurring: No</div>
    }
    <button class="btn btn-primary btn-sm" onclick="location.href='/Chore/AddKidToChore/@Model.Chore.Id'">Add Child To Task</button>
</div>

<h4>List Of Children Currently On This Task</h4>
<table class="table table-hover table-striped">
    <tr>
        <th>Child Name</th>
        <th colspan="2">Child Grade</th>
    </tr>
    @foreach (var c in @Model.Kids)
    {
        <tr onclick="location.href='/Kid/KidDetail/@c.Id'">
            <td>@c.Name</td>
            <td>@c.Grade</td>
            <td>
                <form method="post" action="/Chore/RemoveKidFromChore">
                    <input type="hidden" name="kidId" value="@c.Id" />
                    <input type="hidden" name="choreId" value="@Model.Chore.Id" />
                    <input type="submit" value="X" class="btn btn-danger btn-sm" />
                </form>
            </td>


        </tr>
    }
</table>

<div>
    <button class="btn btn-primary btn-sm" onclick="location.href='/Chore/EditChore/@Model.Chore.Id'">Edit Chore</button>
    <button class="btn btn-primary btn-sm" onclick="location.href='/Chore/DeleteChore/@Model.Chore.Id'">Delete Chore</button>
</div>